1 check1=0 #creating check to use in loop
2 check2=
0 #creating check to use in loop
3 check3=
0 #creating check to use in loop
4 check4=
0 #creating check to use in loop
5 opp=
'a' #defining the variable
6 while
opp!='c': #defining loop exit condition
7     opp=input(
"WELCOME TO ZOO MANAGEMENT SYSTEM \nIf you want to add record of animals then Please press \'a\' \
8     to
add record.\nIf you want to edit record then please press \'e\' \nIf you want to View the records then \
9     please press \'v\' \nIf you want to search a record then press \'s\' \nIf you want to close the program \
10     then please press \'c\' \n :"
) #asking the user if user want to add,view,search,edit until he closes the program
11     
if opp=='a' or opp=='e' or opp=='v' or opp=='s' or opp=='c':#applying condition that if user enters any of these keys,then program contniues
12         
if opp=='a':#if user enters "a" then this condition will be executed
13             num=eval(input(
"How many animals records do you want to enter (max entries= 4)"))#asking user that how many entries user wants to enter
14             
if num>=1 and num<=4:#applying condition that user must enter entries from 1 to 4
15                 i=
1# creating check for loop
16                 
while num!=i-1:#applying exit condition for loop that when num==i-1 loop terminates
17                     
if i==1:#checking the value of i and then execute this step
18                         animal_name1=input(
"Enter 1st Animal name :")#taking user input
19                         cage_no1=input(
"Enter 1st Cage number :")#taking user input
20                         feed_no1=input(
"Enter 1st Feed Number :")#taking user input
21                         breed_no1=input(
"Enter 1st breed :")#taking user input
22                         record1=(
"The 1st record of animal is "+str(animal_name1)+" - "+str(cage_no1)+" - "+str(feed_no1)+\
23                                  
" - "+str(breed_no1))#storing all record of 1 entity in one variable
24                         check1=
1#applying another check so that we can use it in other functions of this program
25                         i+=
1#taking increment in i
26                     elif i==
2:#checking the value of i and then execute this step
27                         animal_name2=input(
"Enter 2nd Animal name :")#taking user input
28                         cage_no2=input(
"Enter 2nd Cage number :")#taking user input
29                         feed_no2=input(
"Enter 2nd Feed Number :")#taking user input
30                         breed_no2=input(
"Enter 2nd breed :")#taking user input
31                         record2=
"The 2nd record of animal is "+str(animal_name2)+" - "+str(cage_no2)+" - "+str(feed_no2)+\
32                                  
" - "+str(breed_no2)#storing all record of 1 entity in one variable
33                         check2=
1#applying another check so that we can use it in other functions of this program
34                         i+=
1
35                     elif i==
3:#checking the value of i and then execute this step
36                         animal_name3=input(
"Enter 3rd Animal name :")#taking user input
37                         cage_no3=input(
"Enter 3rd Cage number :")#taking user input
38                         feed_no3=input(
"Enter 3rd Feed Number :")#taking user input
39                         breed_no3=input(
"Enter 3rd breed :")#taking user input
40                         record3=(
"The 1st record of animal is "+str(animal_name3)+" - "+str(cage_no3)+" - "+str(feed_no3)+\
41                                  
" - "+str(breed_no3))#storing all record of 1 entity in one variable
42                         check3=
1#applying another check so that we can use it in other functions of this program
43                         i+=
1
44                     
else:#if i==4 then this step will executed
45                         animal_name4=input(
"Enter 4th Animal name :")#taking user input
46                         cage_no4=input(
"Enter 4th Cage number :")#taking user input
47                         feed_no4=input(
"Enter 4th Feed Number :")#taking user input
48                         breed_no4=input(
"Enter 4th breed :")#taking user input
49                         record4=(
"The 1st record of animal is "+str(animal_name4)+" - "+str(cage_no4)+" - "+str(feed_no4)+\
50                                  
" - "+str(breed_no4))#storing all record of 1 entity in one variable
51                         check4=
1#applying another check so that we can use it in other functions of this program
52                         i+=
1
53             
else:#if user enter a number not from above condition then only this step will be executed
54                print (
"wrong number")
55                         
56         elif opp==
'e':#if user enters e to edit record
57                 Record_no=eval(input(
"Enter the record number to be edited"))#taking user input
58                 
if Record_no<=4 and Record_no>=1:#applying condition that user must have to enter numbers from 1 to 4
59                     
if Record_no==1:#if user enter 1 then only this record will be executed
60                         animal_name1=input(
"Enter 1st Animal name :")#taking user input
61                         cage_no1=input(
"Enter 1st Cage number :")#taking user input
62                         feed_no1=input(
"Enter 1st Feed Number :")#taking user input
63                         breed_no1=input(
"Enter 1st breed :")#taking user input
64                         record1=
"The 1st record of animal is "+str(animal_name1)+" - "+str(cage_no1)+" - "+str(feed_no1)+\
65                                  
" - "+str(breed_no1)#storing all record of 1 entity in one variable
66                     elif Record_no==
2:#if user enter 2 then only this record will be executed
67                           
68                           animal_name2=input(
"Enter 2nd Animal name :")#taking user input
69                           cage_no2=input(
"Enter 2nd Cage number :")#taking user input
70                           feed_no2=input(
"Enter 2nd Feed Number :")#taking user input
71                           breed_no2=input(
"Enter 2nd breed :")#taking user input
72                           record2=
"The 2nd record of animal is "+str(animal_name2)+" - "+str(cage_no2)+" - "+str(feed_no2)+\
73                                  
" - "+str(breed_no2)#storing all record of 1 entity in one variable
74                     elif Record_no==
3:#if user enter 3 then only this record will be executed
75                           animal_name3=input(
"Enter 3rd Animal name :")#taking user input
76                           cage_no3=input(
"Enter 3rd Cage number :")#taking user input
77                           feed_no3=input(
"Enter 3rd Feed Number :")#taking user input
78                           breed_no3=input(
"Enter 3rd breed :")#taking user input
79                           record3=
"The 1st record of animal is "+str(animal_name3)+" - "+str(cage_no3)+" - "+str(feed_no3)+\
80                                      
" - "+str(breed_no3)#storing all record of 1 entity in one variable
81                     
else:##if user enter 4 then only this record will be executed
82                         
83                         animal_name4=input(
"Enter 4th Animal name :")#taking user input
84                         cage_no4=input(
"Enter 4th Cage number :")#taking user input
85                         feed_no4=input(
"Enter 4th Feed Number :")#taking user input
86                         breed_no4=input(
"Enter 4th breed :")#taking user input
87                         record4=
"The 1st record of animal is "+str(animal_name4)+" - "+str(cage_no4)+" - "+str(feed_no4)+\
88                                  
" - "+str(breed_no4)#storing all record of 1 entity in one variable
89                             
90                                                      
91                 
else:#if user doesnt enter number from above condition then only this step will be executed
92                     print(
"Not Found")
93         
94         elif opp==
'v':#if user enters v to view records then this step will be executed
95             Record_no=eval(input(
"which record No do you want to view. please enter record No. :"))#taking user input
96             
if Record_no>=1 and Record_no<=4:#applying condition so that user must enter value from 1 to 4
97                 
if Record_no==1:#if user enter 1 then only this record will be executed
98                     
if check1==1:#this will check that whether the record exists or not
99                         print (record1)
100                     
else:
101                         print (
"Not Found")
102                 elif Record_no==
2:#this will check whether user enter 2
103                     
if check2==1:#this will check that whether the record exists or not
104                         print (record2)
105                     
else:
106                         print (
"Not Found")
107                 elif Record_no==
3:#this will check whether user enter 3
108                     
if check3==1:#this will check that whether the record exists or not
109                         print (record3)
110                     
else:
111                         print (
"Not Found")
112                 elif Record_no==
4:#this will check whether user enter 4
113                     
114                     
if check4==1:#this will check that whether the record exists or not
115                         print (record4)
116                     
else:
117                         print (
"Not Found")
118                 
else:#if user doesnt enter number from given condition then this will executed
119                     print (
"Record Not Found")
120         elif opp==
's':#if user enter s to search record in program
121             Record_=input(
"If you want to search from animal name then press \'a\' \nIf you want to search\
122 from
feed number the press \'f\' \nIf you want to search from breed number press \'b\' \nIf you want to \
123 search
from cage no then press \'c\' \n: ")#taking user input
124             
if Record_=='a':#if user press a
125                 animal_search=input(
"enter animal name :")#taking user input
126                 
if check1==1:#this will check whether record exists and then check from it
127                     
if animal_search==animal_name1:
128                         chck1=
0
129                         print (
"Record Find \n",record1)
130                     
else:
131                         chck1=
1
132                 
else:
133                     chck1=
1
134                     
135                 
if check2==1:#this will check whether record exists and then check from it
136                     
if animal_search==animal_name2:
137                         chck2=
0
138                         print (
"Record Find \n",record2)
139                     
else:
140                         chck2=
2
141                 
else:
142                     chck2=
2
143                 
if check3==1:#this will check whether record exists and then check from it
144                     
if animal_search==animal_name3:
145                         chck3=
0
146                         print (
"Record Find \n",record3)
147                     
else:
148                         chck3=
3
149                 
else:
150                     chck3=
3
151                 
if check4==1:
152                     
if animal_search==animal_name4:
153                         chck4=
0
154                         print (
"Record Find \n",record4)
155                     
else:
156                         chck4=
4
157                 
else:
158                     chck4=
4
159                 
if chck1==1 and chck2==2 and chck3==3 and chck4==4:#this will check from each record whether it is present or not if all are present then this will execute
160                     print (
"record not Found")
161             
if Record_=='b':#if user wants to search from breed
162                 breed_search=input(
"enter breed no :")#taking user input
163                 
if check1==1:#this will check whether each record exists and then check from it
164                     
if breed_search==breed_no1:
165                         chck1=
0
166                         print (
"Record Find \n",record1)
167                     
else:
168                         chck1=
1
169                 
else:
170                     chck1=
1
171                 
if check2==1:#this will check whether each record exists and then check from it
172                     
if breed_search==breed_no2:
173                         chck2=
0
174                         print (
"Record Find \n",record2)
175                     
else:
176                         chck2=
1
177                 
else:
178                     chck2=
1
179                 
if check3==1:#this will check whether each record exists and then check from it
180                     
if breed_search==breed_no3:
181                         chck3=
0
182                         print (
"Record Find \n",record3)
183                     
else:
184                         chck3=
1
185                 
else:
186                     chck3=
1
187                 
if check4==1:#this will check whether each record exists and then check from it
188                     
if breed_search==breed_no4:
189                         chck4=
0
190                         print (
"Record Find \n",record4)
191                     
else:
192                         chck4=
1
193                 
else:
194                     chck4=
1
195                 
if chck1==1 and chck2==1 and chck3==1 and chck4==1:#this will check from each record whether it is present or not if all are present then this will execute
196                     print (
"record not Found")
197             
if Record_=='f':#if user want to search from feed
198                 feed_search=input(
"enter feed no :")#taking user input
199                 
if check1==1:#this will check whether each record exists and then check from it
200                     
if feed_search==feed_no1:
201                         chck1=
0
202                         print (
"Record Find \n",record1)
203                     
else:
204                         chck1=
1
205                 
else:
206                     chck1=
1
207                 
if check2==1:#this will check whether each record exists and then check from it
208                     
if feed_search==feed_no2:
209                         chck2=
0
210                         print (
"Record Find \n",record2)
211                     
else:
212                         chck2=
1
213                 
else:
214                     chck2=
1
215                 
if check3==1:#this will check whether each record exists and then check from it
216                     
if feed_search==feed_no3:
217                         chck3=
0
218                         print (
"Record Find \n",record3)
219                     
else:
220                         chck3=
1
221                 
else:
222                     chck3=
1
223                 
if check4==1:#this will check whether each record exists and then check from it
224                     
if feed_search==feed_no4:
225                         chck4=
0
226                         print (
"Record Find \n",record4)
227                     
else:
228                         chck4=
1
229                 
else:
230                     chck4=
1
231                 
if chck1==1 and chck2==1 and chck3==1 and chck4==1:#this will check from each record whether it is present or not if all are present then this will execute
232                     print (
"record not Found")
233                 
234             
if Record_=='c':#if user want to search from cage no
235                 cage_search=input(
"enter cage number :")#taking user input
236                 
if check1==1:#this will check whether each record exists and then check from it
237                     
if cage_search==cage_no1:
238                         chck1=
0
239                         print (
"Record Find \n",record1)
240                     
else:
241                         chck1=
1
242                 
else:
243                     chck1=
1
244                 
if check2==1:#this will check whether each record exists and then check from it
245                     
if cage_search==cage_no2:
246                         chck2=
0
247                         print (
"Record Find \n",record2)
248                     
else:
249                         chck2=
1
250                 
else:
251                     chck2=
1
252                 
if check3==1:#this will check whether each record exists and then check from it
253                     
if cage_search==cage_no3:
254                         chck3=
0
255                         print (
"Record Find \n",record3)
256                     
else:
257                         chck3=
1
258                 
else:
259                     chck3=
1
260                 
if check4==1:#this will check whether each record exists and then check from it
261                     
if cage_search==cage_no4:
262                         chck4=
0
263                         print (
"Record Find \n",record4)
264                     
else:
265                         chck4=
1
266                 
else:
267                     chck4=
1
268                 
if chck1==1 and chck2==1 and chck3==1 and chck4==1:#this will check from each record whether it is present or not if all are present then this will execute
269                     print (
"record not Found")
270                 
271                     
272     
else:#if user doesnt enter a valid key from main condition
273         print (
"you enter envalid key. TrY Again")
274                 


Gõ tìm kiếm nhanh...